package com.google.android.exoplayer2.util;

import java.util.Collections;
import java.util.PriorityQueue;
import o.anr;

public final class PriorityTaskManager {
    private final PriorityQueue<Integer> ˋ = new PriorityQueue(10, Collections.reverseOrder());
    private final Object ˎ = new Object();
    private int ˏ = Integer.MIN_VALUE;

    public void ॱ(int i) {
        synchronized (this.ˎ) {
            this.ˋ.add(Integer.valueOf(i));
            this.ˏ = Math.max(this.ˏ, i);
        }
    }

    public void ˊ(int i) throws InterruptedException {
        synchronized (this.ˎ) {
            while (this.ˏ != i) {
                this.ˎ.wait();
            }
        }
    }

    public void ˏ(int i) {
        synchronized (this.ˎ) {
            this.ˋ.remove(Integer.valueOf(i));
            this.ˏ = this.ˋ.isEmpty() ? Integer.MIN_VALUE : ((Integer) anr.ˎ(this.ˋ.peek())).intValue();
            this.ˎ.notifyAll();
        }
    }
}
